using MinoChat.Ui.Enums;
using System.Windows;

namespace MinoChat.Ui.Controls;

/// <summary>
/// 悬停显示文字的按钮控件
/// 默认只显示图标，鼠标悬停时显示 Content 文字
/// </summary>
public class TipButton : Button
{
    static TipButton()
    {
        DefaultStyleKeyProperty.OverrideMetadata(typeof(TipButton), new FrameworkPropertyMetadata(typeof(TipButton)));
    }

    #region 依赖属性
    // 图标类型枚举
    public static readonly DependencyProperty IconProperty =
        DependencyProperty.Register(
            nameof(Icon),
            typeof(IconType),
            typeof(TipButton),
            new PropertyMetadata(IconType.None));
    public IconType Icon
    {
        get => (IconType)GetValue(IconProperty);
        set => SetValue(IconProperty, value);
    }
    // 图标大小
    public static readonly DependencyProperty IconSizeProperty =
        DependencyProperty.Register(
            nameof(IconSize),
            typeof(double),
            typeof(TipButton),
            new PropertyMetadata(14.0));
    public double IconSize
    {
        get => (double)GetValue(IconSizeProperty);
        set => SetValue(IconSizeProperty, value);
    }
    // 图标和文本之间的间距
    public static readonly DependencyProperty SpacingProperty =
        DependencyProperty.Register(
            nameof(Spacing),
            typeof(double),
            typeof(TipButton),
            new PropertyMetadata(3.0));

    public double Spacing
    {
        get => (double)GetValue(SpacingProperty);
        set => SetValue(SpacingProperty, value);
    }

    #endregion
}
